using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using BLL;
using BLL.Impl;

namespace WebUI.Custom
{
    public partial class CustomPage : System.Web.UI.MasterPage
    {
        private ICustomManager customManager;
        protected void Page_Load(object sender, EventArgs e)
        {
            customManager = BLLFactory.CreateCustomManager();
            Model.Custom custom = (Model.Custom)Session["Custom"];
            if (!IsPostBack)
            {
                if (null==Session["Custom"])
                {
                    Response.Redirect("~/Custom/Login.aspx");
                }
                Display(custom);
            }
        }

        private void Display(Model.Custom custom)
        {
            this.lblUserName.Text = custom.PersonName;
            this.lblUserGrade.Text = custom.CustomGrade.ToString();
            this.lblDepart.Text = custom.Department;
        }

        protected void imbReLogin_Click(object sender, ImageClickEventArgs e)
        {

            Session.Remove("Custom");
            Response.Redirect("~/Custom/Login.aspx");
        }
    }
}
